-
Notifications
You must be signed in to change notification settings - Fork 2.7k
test(rustfix): Use snapbox for snapshot testing
#15429
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
079c5f2 to
07b5413
Compare
snapbox and #[cargo_test] for snapshot testing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
`.json` files will have pretty printed json when updated
|
The test |
snapbox and #[cargo_test] for snapshot testingsnapbox or snapshot testing
snapbox or snapshot testingsnapbox for snapshot testing
That sounds good to me. Could you help do it in an extra commit? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Update cargo 4 commits in 864f74d4eadcaea3eeda37a2e7f4d34de233d51e..d811228b14ae2707323f37346aee3f4147e247e6 2025-04-11 20:37:27 +0000 to 2025-04-15 15:18:42 +0000 - use `zlib-rs` for gzip compression in rust code (rust-lang/cargo#15417) - test(rustfix): Use `snapbox` for snapshot testing (rust-lang/cargo#15429) - chore(deps): update rust crate gix to 0.71.0 [security] (rust-lang/cargo#15391) - Make sure search paths inside OUT_DIR precede external paths (rust-lang/cargo#15221) Also, * The license exception of sha1_smol with BSD-3-Clause is no longer needed, as `gix-*` doesn't depend on it. * Cargo depends on zlib-rs, which is distributed under Zlib license r? ghost
Update cargo 4 commits in 864f74d4eadcaea3eeda37a2e7f4d34de233d51e..d811228b14ae2707323f37346aee3f4147e247e6 2025-04-11 20:37:27 +0000 to 2025-04-15 15:18:42 +0000 - use `zlib-rs` for gzip compression in rust code (rust-lang/cargo#15417) - test(rustfix): Use `snapbox` for snapshot testing (rust-lang/cargo#15429) - chore(deps): update rust crate gix to 0.71.0 [security] (rust-lang/cargo#15391) - Make sure search paths inside OUT_DIR precede external paths (rust-lang/cargo#15221) Also, * The license exception of sha1_smol with BSD-3-Clause is no longer needed, as `gix-*` doesn't depend on it. * Cargo depends on zlib-rs, which is distributed under Zlib license r? ghost
What does this PR try to resolve?
snapboxis used to test the snapshots.jsonfile alone should never cause a test to fail.jsonfiles updated only if expected fix != actual fix &&SNAPSHOTS=overwrite.jsonfiles are updated, the json is pretty printedRUSTFIX_TEST_*for overwriting test snapshots withSNAPSHOTS=overwriteRUSTFIX_TEST_RECORD_FIXED_RUSTfeature is removed (generate a*.fixed.rson demand`). We can add it back whenever needed.Fixes #13891
How should we test and review this PR?
Run tests with:
cargo test -p rustfixAll the test should run as different test cases
nightly tests run only when using nightly version of rustc is used